{include file="public/header" /}
<script src="__SKIN__/js/layui/xm-select.js"></script>


<div class="layui-fluid">
    <div class="layui-card" >
        <div class="layui-card-header">添加审批模板</div>
        <div class="layui-tab">
            <ul class="layui-tab-title">
<!--                <li class="layui-this">有外接表单</li>-->
<!--                <li>无外接表单</li>-->
            </ul>
            <div class="layui-tab-content">
                <div class="layui-tab-item layui-show">
                    <form class="layui-form" action="" id="form" lay-filter="form" style="padding-top:10px;">

                        <div class="layui-form-item">
                            <label class="layui-form-label">模板名</label>
                            <div class="layui-input-block">
                                <input type="text" value="{$list.name}" name="name" lay-verify="title" lay-verify="required" autocomplete="off" autocomplete="off" placeholder="请输入模板名" class="layui-input">
                                <input type="hidden" name="id" value="{$list.id}">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">控制器</label>
                            <div class="layui-input-block">
                                <input type="text" value="{$list.controller}"  disabled name="controller" lay-verify="required" autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux"></div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">表名</label>
                            <div class="layui-input-block">
                                <input type="text" value="{$list.table_name}" disabled  name="table_name" lay-verify="required" autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux"></div>
                        </div>

                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button  type="submit" class="layui-btn" lay-submit="" lay-filter="form">确认修改</button>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="layui-tab-item">
                    <form class="layui-form" action="" id="form1" lay-filter="form1" style="padding-top:10px;">

                        <div class="layui-form-item">
                            <label class="layui-form-label">模板名</label>
                            <div class="layui-input-block">
                                <input type="text" value="{$list.name}" name="name" lay-verify="title" lay-verify="required" autocomplete="off" autocomplete="off" placeholder="请输入模板名" class="layui-input">
                                <input type="hidden" name="id" value="{$list.id}">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button  type="submit" class="layui-btn" lay-submit="" lay-filter="form1">确认修改</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>

    </div>

</div>

<script src="__SKIN__/workflow/js/form_assembly.js" charset="utf-8"></script>
<script src="__SKIN__/js/layui/layui.js" charset="utf-8"></script>
<script>
    var  add_config = [];
    //同步ajax请求数据转出
    var ajax = function(url,data){
        var arr = {};
        $.ajax({
            url:url,
            type:'post',
            data:data,
            dataType:"html",
            async: false,//关闭异步
            success:function(e){
                arr = eval('(' + e + ')');
            }
        });
        return arr;
    }

    layui.use(['table','form','layer','upload','element'], function(){
        var $ = layui.$
            ,table = layui.table
            ,upload = layui.upload
            ,form = layui.form;

        /************************************监听提交（提交表单）***************************/
        form.on('submit(form)', function(data){
            let add_url = "{:url('Workflowajax/edit_flow?type=1')}";
            let res = ajax(add_url,data.field);
            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
            parent.layer.close(index); //再执行关闭
            return false;
        });

        form.on('submit(form1)', function(data){
            let add_url = "{:url('Workflowajax/edit_flow?type=2')}";
            let res = ajax(add_url,data.field);
            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
            parent.layer.close(index); //再执行关闭
            return false;
        });

    });
    /**************************layui实例化结束*************************/




</script>

</body>
</html>